package com.ssy.lingxi.marketing.model.constant;

import java.util.Arrays;
import java.util.List;

/**
 * 可领取枚举
 * @author yzc
 * @version 2.0.0
 * @date 2021/8/13
 */
public enum CanReceiveEnum {

    /**
     * 未登录 - 0
     */
    NO_LOGIN(0, "未登录"),

    /**
     * 不符合条件 - 1
     */
    NO_MATCH(1, "不符合条件"),

    /**
     * 可领取 - 2
     */
    CAN_RECEIVE(2, "可领取"),

    /**
     * 已领取 - 3
     */
    COMPLETE_RECEIVE(3, "已领取");


    private final Integer code;
    private final String message;

    CanReceiveEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getCodeMessage(Integer code) {
        CanReceiveEnum status = Arrays.stream(CanReceiveEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return status == null ? "未知" : status.getMessage();
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static List<CanReceiveEnum> noReceiveList() {
        return Arrays.asList(CanReceiveEnum.NO_LOGIN, CanReceiveEnum.NO_MATCH, CanReceiveEnum.COMPLETE_RECEIVE);
    }

}